package com.qf.admin.controller;

import com.qf.common.response.Response;
import com.qf.entity.po.LoginAdmin;
import com.qf.entity.vo.JqueryTreeList;
import com.qf.service.ModuleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class IndexController {

    @Resource
    ModuleService moduleService;

    /**
     * 前往index页面
     * @return
     */
    @RequestMapping("index")
    public String toIndex(){
        return "index";
    }

    /**
     * 生成页面左侧功能菜单树结构
     * @param loginAdmin
     * @return
     */
    @RequestMapping("func-list")
    @ResponseBody
    public Response<List<JqueryTreeList>> funcList(LoginAdmin loginAdmin){
        return Response.success(moduleService.getJqueryTreeList(loginAdmin.getId()));
    }
}
